package com.heima.controller;

import com.heima.model.comment.dtos.CommentSaveDto;
import com.heima.model.common.dtos.ResponseResult;
import com.heima.service.CommentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 用户评论
 * @author chenshan
 */
@RestController
@RequestMapping("api/v1/comment")
public class CommentController {
    @Autowired
    private CommentService commentService;

    /**
     * 保存评论
     * @param saveDto 用户评论信息
     * @return ResponseResult
     */
    @PostMapping("save")
    public ResponseResult saveComment(@RequestBody CommentSaveDto saveDto) throws Exception {
        return commentService.saveComment(saveDto);
    }
}
